<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="../../css/utils/bootstrap.min.css" />
    <link rel="stylesheet" href="../../css/utils/mui.min.css" />
    <link rel="stylesheet" href="../../css/utils/common.css" />
    <link rel="stylesheet" href="../../css/utils/bootstrap-datetimepicker.css" />
    <link rel="stylesheet" href="../../css/utils/toastr.min.css" />
	<title></title>
	<style>
		.content-body {
			margin: 0 auto;
			margin-top: 30px;
			width: 850px;
		}
		.operate-btn .btn {
			width: 130px;
		}
		.url-content {
			margin-top: 30px;
		}
		.title-bg {
			font-size: 18px;
			color: #111111;
			margin-bottom: 10px;
		}
		.input-prompt {
			visibility: hidden;
			margin-left: 10px;
			color: red;
		}
		.cover-plug {
			margin-top: 10px;
		}
		.title-prompt .title {
			position: relative;
			width: 100%;
		}
		.title-prompt .number-words {
			position: absolute;
			top: 8px;
			right: 20px;
			color: #C7C7C7;
		    font-size: 11px;
		}
		.abstract-prompt {
			width: calc(100% - 180px);
		}
		.title-prompt.abstract-prompt .number-words {
			position: absolute;
			top: auto;
			bottom: 20px;
			right: 20px;
			color: #C7C7C7;
		    font-size: 11px;
		}
		.abstract-prompt textarea {
			height: 120px;
		}
		.preview-img {
			position: relative;
			width: 150px;
			height: 120px;
			background-color: #09262B;
			border: 1px solid #A1A1A1;
			text-align: center;
			line-height: 120px;
		}
		.preview-img p {
			position: absolute;
			width: 100%;
			text-align: center;
			color: #11B5AB;
		}
		.share-file-a {
			display:inline-block;
			width:150px; 
			height:120px; 
			position:relative; 
			overflow:hidden;
		}
		.preview-img input::-webkit-file-upload-button {
            width: 150px;
            height: 120px;
            border: none;
            position: absolute;
            outline: 0;
            opacity: 0;
        }
		.preview-img input[type='file'] {
            display: block;
            vertical-align: middle;
            position:absolute; 
		    width: 150px; 
		    height: 120px; 
		    right:0; 
		    top:0; 
		    font-size:100px; 
		    opacity:0; 
		    filter:alpha(opacity=0);
        }
        .implant-ad {
        	margin-top: 10px;
        	border: 1px solid #A1A1A1;
        	padding: 10px 20px;
        }
        .ad-header {
        	font-size: 16px;
        	color: #1C1C1C;
        }
        .plug-select {
        	margin: 0 auto;
        	margin-top: 10px;
        	width: 390px;
        }
        .btn-tab-sx button.active {
			color: #fff;
			background-color: #11B5AB;
		}
		.btn-tab-sx .btn-default.active:focus, .btn-tab-sx .btn-default.active:hover {
			color: #fff;
			background-color: #2aeee2;
			border-color: #2aeee2;
		}
		.tab-content .tab-pane {
			height: 452px;
		}
		.implant-ad .list-li {
			margin-top: 12px;
			border: 1px solid #A1A1A1;
		}
		.tab-pane .list-li .checkbox-inline,.tab-pane .list-li .radio-inline {
			vertical-align: text-top;
			padding-left: 35px;
		}
		.list-li .list-body {
			display: inline-block;
			vertical-align: middle;
		}
		.tab-pane .list-li .user-info {
			display: inline-block;
			vertical-align: middle;
			color: #666666;
		}
		.user-info .name {
			margin-right: 10px;
		}
		.user-info .position {
			color: #6F6F6F;
			font-size: 12px;
		}
		.user-info .phone {
			font-size: 13px;
		}
		.phone-icon {
			position: absolute;
			width: 50px;
			height: 100%;
			top: 0;
			right: 50px;
			line-height: 50px;
			text-align: center;
			border-left: 1px solid #A1A1A1;
			border-right: 1px solid #A1A1A1;
		}
		.phone-icon img {
			width: 20px;
			height: 20px;
		}
		.wechart-icon {
			position: absolute;
			width: 50px;
			height: 100%;
			top: 0;
			right: 0;
			line-height: 50px;
			text-align: center;
		}
		.wechart-icon img {
			width: 20px;
			height: 20px;
		}
		.li-padding .list-li {
			padding: 14px 0;
		}
		.ad-name {
			color: #666666;
		}
		.href-btn {
			position: absolute;
			height: 100%;
			top: 8px;
			right: 10px;
		}
		
		.label-select {
			margin-top: 20px;
		}
		.label-select .label-title {
			margin-bottom: 10px;
			color: #6F6F6F;
		}
		.label-select .label-group .label {
			display: inline-block;
			padding: 3px 25px;
			margin-right: 20px;
			margin-bottom: 20px;
			background-color: #E1E1E1;
			color: #848484;
			cursor: pointer;
			border-top-left-radius: 10px;
			border-top-right-radius: 10px;
			border-bottom-left-radius: 10px;
			border-bottom-right-radius: 10px;
		}
		.label-select .label-group .label.active {
			background-color: #11B5AB;
			color: #fff;
		}
		
		/*modal*/
		.manage-border {
			display: flex;
			margin: 0 auto;
			border: 1px solid #A1A1A1;
		}
		.staff-tree {
			width: 33%;
			border-right: 1px solid #A1A1A1;
		}
		.search-staff {
			border-bottom: 1px solid #A1A1A1;
		}
		.search-staff img{
			width: 20px;
			margin-left: 20px;
		}
		.search-staff input[type='search'] {
			display: inline-block;
			width: calc(100% - 45px);
			border: none;
		}
		.search-staff input[type="search"]:focus{
		    box-shadow: none;
		}
		
		.tree-view {
			height: 400px;
			padding: 20px 10px;
		}
		.tree-ul {
			padding-left: 20px;
		}
		.tree-li {
			position: relative;
    		display: block;
    		padding: 5px 0;
    		color: #818181;
		}
		.tree-arrow {
			display: inline-block;
			width: 10px;
			height: 10px;
			margin-right: 5px;
			background: url(../../img/myExtension/tree-right.png) no-repeat;
			background-size: 100% 100%;
		}
		.tree-arrow.active {
			background: url(../../img/myExtension/tree-down.png) no-repeat;
			background-size: 100% 100%;
		}
		.tree-title {
			font-weight: bold;
		}
		.tree-view .tree-li input[type='checkbox'] {
			position: absolute;
			top: 5px;
			right: 10px;
			width: 15px;
			height: 15px;
		}
		.staff-name {
			margin-left: 8px;
			vertical-align: middle;
		}
		
		.selected-staff {
			width: 25%;
			border-right: 1px solid #A1A1A1;
		}
		.selected-title {
			width: 100%;
			height: 35px;
			text-align: center;
			line-height: 35px;
			color: #818181;
		}
		.staff-list {
			height: 400px;
			padding: 20px 20px 20px 10px;
		}
		
		.task-require {
			width: 42%;
		}
		.inline-input {
			display: inline-block;
			width: 200px;
			vertical-align: middle;
		}
		.flex-content {
			display: flex;
			justify-content: space-between;
		}
		.form_datetime {
			width: 200px;
		}
		.form-control[readonly] {
			background-color: #fff;
		}
		.form-control[disabled] {
			background-color: #eee;
		}
		/*预览model*/
		.preview-content {
			display: flex;
		}
		.phone-model {
			width: 260px;
			height: 500px;
			margin: 50px 70px;
			padding: 95px 15px 58px 13px;
			background: url(../../img/myExtension/phone-model.png) no-repeat;
			background-size: 100% 100%;
		}
		.phone-content {
			position: relative;
			width: 100%;
			height: 100%;
			padding: 0 0 10px 10px;
			color: #666666;
		}
		#previewArticle {
			padding-top: 10px;
			padding-bottom: 50px;
		}
		.phone-title {
			color: #111;
			/*font-size: 16px;*/
		}
		.phone-body {
			font-size: 12px;
		}
		.phone-body img {
			max-width: 100%;
			height: auto;
		}
		.scan-wechat {
			margin-top: 70px;
		}
		.preview-qrcode {
			width: 386px;
			height: 220px;
			border: 1px solid #A1A1A1;
			text-align: center;
		}
		.preview-qrcode .qrcode {
			width: 150px;
			height: 150px;
			margin: 0 auto;
			margin-top: 25px;
			border: 1px solid #A1A1A1;
		}
		.preview-qrcode .qrcode canvas {
			width: 100%;
			height: 100%;
		}
		.preview-qrcode .prompt {
			margin-top: 10px;
			color: #6B6B6B;
		}
		.wechat-share {
			margin-top: 110px;
			padding: 10px;
			width: 386px;
			height: 132px;
			border: 1px solid #A1A1A1;
		}
		.wechat-title {
			font-size: 16px;
			color: #666666;
		}
		.wechat-content {
			display: flex;
			margin-top: 20px;
		}
		.wechat-describe {
			width: calc(100% - 80px);
			height: 62px;
			color: #8E8E8E;
			display: -webkit-box;
		    overflow: hidden;
		    white-space: normal!important;
		    text-overflow: ellipsis;
		    word-wrap: break-word;
		    -webkit-line-clamp: 3;
		    -webkit-box-orient: vertical;
		}
		.wechat-icon img {
			vertical-align: top;
			margin-left: 10px;
			width: 60px;
			height: 60px;
		}
		/*发布MODEL*/
		.publish-qrcode .qrcode {
			width: 150px;
			height: 150px;
			margin: 0 auto;
			border: 1px solid #A1A1A1;
		}
		.publish-qrcode .qrcode canvas {
			width: 100%;
			height: 100%;
		}
		.publish-qrcode .prompt {
			text-align: center;
			margin-top: 15px;
			color: #6B6B6B;
		}
		/*nar报名卡片*/
		.mui-bar {
			position: absolute;
			font-size: 12px;
		}
		.tickets-tab {
			display: none;
		}
		.enroll-tab {
			display: none;
		}
		.mui-bar .mui-btn,.mui-bar button {
			font-size: 12px;
		}
		.title-item {
			display: table-cell;
			-webkit-flex: 1;
			-moz-box-flex: 1;
			-ms-flex: 1;
			flex: 1;
			vertical-align: middle;
			padding-left: 10px;
			color: #333;
		}
		.btn-item {
			width: 85px;
			display: table-cell;
			text-align: center;
		}
		.mui-bar .mui-btn {
			padding: 6px 12px;
		}
		/*nar名片卡片*/
		.card-tab {
			display: none;
		}
		.merge-tab {
			display: none;
		}
		.merge-qrcode-item {
			display: none;
		}
		.merge-enroll-item {
			display: none;
		}
		.merge-ticket-item {
			display: none;
		}
		.merge-user-item {
			display: none;
			position: relative;
			display: table-cell;
			vertical-align: middle;
			padding-left: 10px;
			-webkit-flex: 1;
			-moz-box-flex: 1;
			-ms-flex: 1;
			flex: 1;
			height: 50px;
		}
		.user-item {
			position: relative;
			display: table-cell;
			vertical-align: middle;
			padding-left: 5px;
			-webkit-flex: 1;
			-moz-box-flex: 1;
			-ms-flex: 1;
			flex: 1;
			height: 50px;
		}
		.head-img {
			position: absolute;
			top: -15px;
			width: 45px;
			height: 45px;
			padding: 1px;
			border-radius: 50%;
			background-color: #fff;
		}
		.head-img img {
			width: 100%;
			height: 100%;
			border-radius: 50%;
		}
		.qrcode-item {
			display: table-cell;
		}
		.phone-item {
			display: table-cell;
		}
		.icon-item {
			width: 30px;
			height: 30px;
			border-left: 1px solid #CBCBCB;
			vertical-align: middle;
 		   	text-align: center;
		}
		.icon-item img {
			width: 15px;
			height: 15px;
		}
		.user-info-bar {
			margin-left: 48px;
			color: #333;
		}
		.user-info-bar .name {
			margin-right: 10px;
		}
		.user-info-bar .position {
			font-size: 12px;
			color: #666666;
		}
		#subTaskBtn {
			display: none;
		}
	</style>
</head>
<body>
	<div class="content content-body">
		<div class="operate-btn">
			<button id="subTaskBtn" type="button" data-param="1" class="btn btn-default">分任务</button>
			<button type="button" data-param="2" class="btn btn-default">保存</button>
			<button type="button" data-param="3" class="btn btn-default">预览</button>
			<button type="button" data-param="4" class="btn btn-default">发布</button>
		</div>
		<div class="url-content">
			<div class="title-bg">输入链接地址</div>
			<div class="url-input">
				<input type="text" id="contentsLink" class="form-control" placeholder="请输入正确的链接地址">
				<div id="contentsLinkPrompt" class="input-prompt">请输入正确格式的链接地址</div>
			</div>
		</div>
		<div class="cover-plug">
			<div class="title-bg">图文封面</div>
			<div class="title-prompt">
				<div class="title">
					<span class="number-words"><span>32</span>/32</span>
					<input type="text" id="title" maxlength="32" class="form-control" onkeyup="checklength(this,32);" placeholder="文章标题（最多32个字）">
				</div>
				<div class="input-prompt">标题内容不能为空</div>
			</div>
			<div class="space-between" style="margin-top: 10px;">
				<div class="title-prompt abstract-prompt">
					<div class="title">
						<span class="number-words"><span>54</span>/54</span>
						<textarea class="form-control" id="abstracts" maxlength="54" rows="5" onkeyup="checklength(this,54);" placeholder="文章摘要（最多54个字）"></textarea>
					</div>
					<div class="input-prompt">摘要内容不能为空</div>
				</div>	
				<div class="preview-img">
					<input type="hidden" id="imageUrl" value="" />
					<p>分享预览图</p>
					<a class="share-file-a">
						<input type="file" name="previewImg" value="" accept="image/*" multiple onchange="handleInputChange(this);" />
					</a>
				</div>
			</div>
			<div class="implant-ad">
				<div class="ad-header">植入广告</div>
				<div class="plug-select">
					<div class="btn-group btn-group-justified btn-tab-sx" role="group" aria-label="button-group">
						<div class="btn-group" role="group">
							<button type="button" panel-data="tab-panel1" class="btn btn-default active">名片</button>
						</div>
						<div class="btn-group" role="group">
							<button type="button" panel-data="tab-panel2" class="btn btn-default">报名</button>
						</div>
						<div class="btn-group" role="group">
							<button type="button" panel-data="tab-panel3" class="btn btn-default">门票</button>
						</div>
						<div class="btn-group" role="group">
							<button type="button" panel-data="tab-panel4" class="btn btn-default">商品</button>
						</div>
						<div class="btn-group" role="group">
							<button type="button" panel-data="tab-panel5" class="btn btn-default">代金券</button>
						</div>
						<div class="btn-group" role="group">
							<button type="button" panel-data="tab-panel6" class="btn btn-default">打折券</button>
						</div>
					</div>
					<div class="tab-content">
						<div id="tab-panel1" class="tab-pane refresh-scroll active">
							<ul class="list-ul">
								<!--<li class="list-li">
									<label class="radio-inline">
										<input type="radio" name="cardsRadio" value="option1">
									</label>
									<div class="list-body">
										<img class="border-radius-40" src="../../img/headimg.jpg" />
										<div class="user-info">
											<span class="name">王经理</span><span class="position">销售总监</span><br />
											<span class="phone">18685306265</span>
										</div>
										<div class="phone-icon">
											<img src="../../img/myExtension/phone.png" />
										</div>
										<div class="wechart-icon">
											<img src="../../img/myExtension/wechart.png" />
										</div>
									</div>
								</li>-->
							</ul>
						</div>
						<div id="tab-panel2" class="tab-pane refresh-scroll li-padding">
							<ul class="list-ul">
								<!--<li class="list-li">
									<label class="radio-inline">
										<input type="radio" name="enrollRadio" value="option1">
									</label>
									<div class="list-body">
										<div class="ad-name">
											<a>活动名称</a>
										</div>
										<div class="href-btn">
											<button type="button" class="btn btn-default">马上报名</button>
										</div>
									</div>
								</li>-->
							</ul>
						</div>
						<div id="tab-panel3" class="tab-pane refresh-scroll li-padding">
							<ul class="list-ul">
								<!--<li class="list-li">
									<label class="radio-inline">
										<input type="radio" name="goodsRadio" value="option1">
									</label>
									<div class="list-body">
										<div class="ad-name">
											<a>商品名称</a>
										</div>
										<div class="href-btn">
											<button type="button" class="btn btn-default">立即购买</button>
										</div>
									</div>
								</li>-->
							</ul>
						</div>	
						<div id="tab-panel4" class="tab-pane refresh-scroll li-padding">
							<ul class="list-ul">
							</ul>
						</div>
						<div id="tab-panel5" class="tab-pane refresh-scroll li-padding">
							<ul class="list-ul">
							</ul>
						</div>
						<div id="tab-panel6" class="tab-pane refresh-scroll li-padding">
							<ul class="list-ul">
							</ul>
						</div>
					</div>	
				</div>
			</div>
		</div>
		<div class="label-select">
			<div class="label-title">
				<label>标签：</label>
			</div>
			<div class="label-group">
				<!--<span class="label label-default active">奶茶</span>-->
			</div>
		</div>
	</div>	
	
	<!-- 分任务Modal -->
	<div class="modal fade bs-example-modal-lg" id="subTaskModel" tabindex="-1" role="dialog" aria-labelledby="subTaskModelLabel">
		<div class="modal-dialog modal-lg modal-1234" role="document">
			<div class="modal-content">
				<div class="modal-header">
			    	<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
			    	<h4 class="modal-title" id="subTaskModelLabel">任务指派</h4>
				</div>
			  	<div class="modal-body">
			    	<div class="manage-border">
			    		<div class="staff-tree">
			    			<div class="search-staff">
			    				<img src="../../img/myExtension/search-ash.png" />
			    				<input id="searchInput" type="search" class="form-control" placeholder="输入员工姓名">
			    			</div>
			    			<div class="tree-view refresh-scroll">
			    				<ul id="staffTree" class="tree-ul">
									<!--<li class="tree-li">
										<span class="tree-arrow active"></span>
										<span class="tree-title">乐子科技</span>
										<input type="checkbox" />
										<ul class="tree-ul">
											<li class="tree-li">
												<span class="tree-arrow"></span>
												<span>秘书部</span>
												<input type="checkbox" />
											</li>	
											<li class="tree-li">
												<span class="tree-arrow active"></span>
												<span>销售部</span>
												<input type="checkbox" />
												<ul class="tree-ul">
													<li class="tree-li">
														<img class="border-radius-20" src="../../img/headimg.jpg" />
														<span class="staff-name">隔壁老王</span>
														<input type="checkbox" />
													</li>	
												</ul>
											</li>
										</ul>	
									</li>-->
								</ul>
			    			</div>
			    		</div>
			    		<div class="selected-staff">
			    			<div class="selected-title">
			    				已经选择的员工
			    			</div>
			    			<div id="selectList" class="staff-list refresh-scroll">
			    				<ul class="tree-ul">
									<!--<li class="tree-li">
										<img class="border-radius-20" src="../../img/headimg.jpg" />
										<span class="staff-name">隔壁老王</span>
										<button class="close"><span>&times;</span></button>
									</li>-->
								</ul>	
			    			</div>
			    		</div>
			    		<div class="task-require">
			    			<div class="selected-title">
			    				任务要求
			    			</div>
			    			<div class="staff-list">
			    				<ul class="tree-ul">
									<li class="tree-li flex-content">
										<span>转发数（>不低于）</span>
										<input type="number" id="forwordNum" class="form-control inline-input" maxlength="5" placeholder="" value="0">
									</li>
									<li class="tree-li flex-content">
										<span>阅读数（>不低于）</span>
										<input type="number" id="readNum" class="form-control inline-input" maxlength="5" placeholder="" value="0">
									</li>
									<li class="tree-li flex-content">
										<span>报名数（>不低于）</span>
										<input type="number" id="enrollNum" class="form-control inline-input" maxlength="5" placeholder="" value="0">
									</li>
									<li class="tree-li">
										<span>任务执行时限</span>
									</li>	
									<li class="tree-li flex-content">
										<div id="startDateTimePicker" class="input-group date form_datetime" data-date="" data-date-format="yyyy-mm-dd" data-link-field="dtp_input1">
						                    <input id="startDateTime" class="form-control" size="16" type="text" value="" disabled="disabled" readonly>
						                    <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
											<span class="input-group-addon"><span class="glyphicon glyphicon-th"></span></span>
						                </div>
						                <span style="margin-top: 6px;">至</span>
										<div id="endDateTimePicker" class="input-group date form_datetime" data-date="" data-date-format="yyyy-mm-dd" data-link-field="dtp_input1">
						                    <input id="endDateTime" class="form-control" size="16" type="text" value="" disabled="disabled" readonly>
						                    <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
											<span class="input-group-addon"><span class="glyphicon glyphicon-th"></span></span>
						                </div>
									</li>
									<li class="tree-li flex-content">
										<div id="noLimitData" class="checkbox">
											<label>
										    	<input type="checkbox" value="" checked="checked">
										    	不限时间
											</label>
										</div>
									</li>
								</ul>	
			    			</div>
			    		</div>
			    	</div>
			  	</div>
			  	<div class="modal-footer">
			    	<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
			    	<button type="button" id="saveSubTask" class="btn btn-primary">确认</button>
			  	</div>
			</div>
		</div>
	</div>
	<!--预览model-->
	<div class="modal fade bs-example-modal-lg" id="previewModel" tabindex="-1" role="dialog" aria-labelledby="previewLabel">
		<div class="modal-dialog modal-lg" role="document">
			<div class="modal-content">
				<div class="modal-header">
			    	<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
			    	<h4 class="modal-title" id="previewLabel">预览</h4>
				</div>
			  	<div class="modal-body">
			  		<div class="preview-content">
				    	<div class="phone-model">
				    		<div  class="phone-content">
				    			<iframe src="" id="iframePage" frameborder="0" scrolling="yes" marginwidth="0" marginheight="0" style="height: 280px;width: 216px;"></iframe>
				    			<!--报名-->
								<nav class="mui-bar mui-bar-tab enroll-tab">
									<div class="title-item">
										报名信息防静电索拉卡
									</div>
									<div class="btn-item">
										<button type="button" class="mui-btn btn-theme">立即报名</button>
									</div>
								</nav>
								<!--报名-->
								<nav class="mui-bar mui-bar-tab tickets-tab">
									<div class="title-item">
										报名信息防静电索拉卡
									</div>
									<div class="btn-item">
										<button type="button" class="mui-btn btn-theme">立即领票</button>
									</div>
								</nav>
								<!--名片插件管理-->
								<nav class="mui-bar mui-bar-tab card-tab">
									<div class="user-item">
										<!--<a class="head-img">
											<img src="../../img/login/logo.png" />	
										</a>
										<div class="user-info-bar">
											<span class="name">张三丰</span><span class="position">销售总监</span><br />
											<a class="phone" href="tel:">1383838438</a>
										</div>-->
									</div>
									<div class="icon-item qrcode-item customer-wechat-click">
										<img src="../../img/phone/wechat-icon.png" />
									</div>
									<a class="icon-item phone-item customer-phone-click" href="#">
										<img src="../../img/phone/phone-icon.png" />
									</a>
								</nav>
								<!--名片和报名-->
								<nav class="mui-bar mui-bar-tab merge-tab">
									<div class="merge-user-item">
										<!--<a class="head-img">
											<img src="../../img/login/logo.png" />	
										</a>
										<div class="user-info-bar">
											<span class="name">用户名字</span><span class="position">销售总监</span><br />
											<a class="phone" href="tel:18685306265">18685306265</a>
										</div>-->
									</div>
									<div class="icon-item merge-qrcode-item customer-wechat-click">
										<img src="../../img/phone/wechat-icon.png" />
									</div>
									<div class="icon-item merge-enroll-item">
										<!--<span class="text-11B5AB">报名</span>-->
									</div>
									<div class="icon-item merge-ticket-item">
										<!--<span class="text-11B5AB">领票</span>-->
									</div>
								</nav>
				    		</div>
				    	</div>
				    	<div class="scan-wechat">
				    		<div class="preview-qrcode">
				    			<div class="qrcode"></div>
				    			<div class="prompt">
				    				微信扫一扫，开始分享
				    			</div>
				    		</div>
				    		<div class="wechat-share">
				    			<!--<div class="wechat-title text-ellipsis"></div>
				    			<div class="wechat-content">
				    				<div class="wechat-describe"></div>
				    				<div class="wechat-icon">
				    					<img src="../../img/HBuilder.png"/>
				    				</div>
				    			</div>-->
				    		</div>
				    	</div>
			    	</div>
			  	</div>
			</div>
		</div>
	</div>
	<!-- 发布MODEL  -->
	<div class="modal fade bs-example-modal-sm" id="publishModel" tabindex="-1" role="dialog" aria-labelledby="publishModelLabel">
		<div class="modal-dialog modal-sm" role="document">
			<div class="modal-content">
				<div class="modal-header">
			    	<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
			    	<h4 class="modal-title" id="publishModelLabel">分享微信链接</h4>
				</div>
			  	<div class="modal-body">
			  		<div class="publish-qrcode">
		    			<div class="qrcode"></div>
		    			<div class="prompt">
		    				微信扫一扫，开始分享
		    			</div>
		    		</div>
			  	</div>
			</div>
		</div>
	</div>
	
	<script type="text/javascript" src="../../js/utils/jquery-1.12.4.min.js" ></script>
	<script type="text/javascript" src="../../js/utils/bootstrap.min.js" ></script>
	<script type="text/javascript" src="../../js/utils/bootstrap-datetimepicker.min.js" ></script>
	<script type="text/javascript" src="../../js/utils/bootstrap-datetimepicker.fr.js" ></script>
	<script type="text/javascript" src="../../js/utils/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
	<script type="text/javascript" src="../../js/utils/jquery.cookie.js" ></script>
	<script type="text/javascript" src="../../js/utils/jquery.qrcode.min.js" ></script>
	<script type="text/javascript" src="../../js/utils/toastr.min.js" ></script>
	<script type="text/javascript" src="../../js/utils/regular.js?version=1" ></script>
	<script type="text/javascript" src="../../js/utils/boot.js" ></script>
	<script>
		var userID,companyID,articleID,QRCodeUrl;
		var cardsRadioID,enrollRadioID,ticketsRadioID,goodsRadioID,vouchersRadioID,discountCouponsRadioID;
		var lableIDList;
		var operation = 2;//默认保存
		$(function(){
			articleID = base.getParameter("articleID");
			userID = $.cookie("userID");
			companyID = $.cookie("companyID");
			toastr.options = {
                "timeOut": 2000,
                "positionClass": "toast-middle-center"
            };
            //是否显示分任务按钮
            $(".menu-aside .list-group-item", parent.document).each(function(){
            	if ($(this).find("a").attr("data-href") == "myTask/myTask.html") {
            		$("#subTaskBtn").show();
            	}
            });
            //获取推文详情
            if (articleID != null && articleID != "") {
            	base.postData(base.url.getArticleInfo, {userID:userID,companyID:companyID,articleID:articleID}, callbackGetArticleInfo);
            }else{
            	//获取卡片列表
				base.postData(base.url.getCardList, {userID:userID,companyID:companyID,type:1}, callbackGetCardList);
				//获取报名列表
				base.postData(base.url.getEnrollList, {userID:userID,companyID:companyID,type:1}, callbackGetEnrollList);
				//获取门票列表
				base.postData(base.url.getTicketsList, {userID:userID,companyID:companyID,type:1}, callbackGetTicketsList);
				//获取商品列表
				base.postData(base.url.getGoodsList, {userID:userID,companyID:companyID,type:1}, callbackGetGoodsList);
				//获取代金券
				base.postData(base.url.getVouchersList, {userID:userID,companyID:companyID}, callbackGetVouchersList);
				//获取打折券
				base.postData(base.url.getDiscountCouponsList, {userID:userID,companyID:companyID}, callbackGetDiscountCouponsList);
				//获取公司标签
				base.postData(base.url.lableList, {userID:userID,companyID:companyID}, callbackLableList);	
            }
            			
		});
		$("#contentsLink").on("keyup", function(){
			if (isURL($(this).val())) {
				$("#contentsLinkPrompt").css("visibility","hidden");
			}else{
				$("#contentsLinkPrompt").css("visibility","visible");
			}
		});
		//输入框字节长度
		function checklength(obj, number){
			if ($(obj).val().length > number) {
				$(obj).val($(obj).val().substring(0, number));
			}
			$(obj).closest(".title-prompt").find(".number-words span").text(number - $(obj).val().length);
			if ($(obj).val().length == 0) {
				$(obj).closest(".title-prompt").find(".input-prompt").css("visibility","visible");
			}else {
				$(obj).closest(".title-prompt").find(".input-prompt").css("visibility","hidden");
			}
		}
		//插件选择器
		$(".btn-tab-sx").on("click", "button", function(){
			$(".btn-tab-sx button").removeClass("active");
			$(this).addClass("active");
			var panelId = $(this).attr("panel-data");
			$(".tab-content .tab-pane").removeClass("active");
			$("#"+panelId).addClass("active");
		});
		//名片列表返回
		function callbackGetCardList(data){
			if (data.success) {
				var html = "";
				for (var i=0; i<data.context.cardList.length; i++) {
					html += pingCardList(data.context.cardList[i]);
				}
				$("#tab-panel1 .list-ul").html(html);
			}
		}
		function pingCardList(data) {
			var html = '<li class="list-li">'+
						'	<label class="radio-inline">';
						if (cardsRadioID == data.cardID) {
				html +=	'		<input type="radio" checked="checked" name="cardsRadio" value="'+data.cardID+'">';
						}else{
				html +=	'		<input type="radio" name="cardsRadio" value="'+data.cardID+'">';			
						}
				html +=	'	</label>'+
						'	<div class="list-body">'+
						'		<img class="border-radius-40" src="'+data.cardHeadImgUrl+'" />'+
						'		<div class="user-info">'+
						'			<span class="name">'+data.cardUserName+'</span><span class="position">'+data.post+'</span><br />'+
						'			<span class="phone">'+data.cardUserPhone+'</span>'+
						'		</div>'+
						'		<div class="phone-icon">'+
						'			<img src="../../img/myExtension/phone.png" />'+
						'		</div>'+
						'		<div class="wechart-icon">'+
						'			<img src="../../img/myExtension/wechart.png" />'+
						'		</div>'+
						'	</div>'+
						'</li>';
			return html;			
		}
		//报名列表返回
		function callbackGetEnrollList(data) {
			if (data.success) {
				var html = "";
				for (var i=0; i<data.context.enrollList.length; i++) {
					html += pingEnrollList(data.context.enrollList[i]);
				}
				$("#tab-panel2 .list-ul").html(html);
			}
		}
		function pingEnrollList(data) {
			var html = '<li class="list-li">'+
						'	<label class="radio-inline">';
						if (enrollRadioID == data.enrollID) {
				html +=	'		<input type="radio" checked="checked" name="enrollRadio" value="'+data.enrollID+'">';
						}else{
				html +=	'		<input type="radio" name="enrollRadio" value="'+data.enrollID+'">';			
						}
				html +=	'	</label>'+
						'	<div class="list-body">'+
						'		<div class="ad-name">'+
						'			<a>'+data.activityTitle+'</a>'+
						'		</div>'+
						'		<div class="href-btn">'+
						'			<button type="button" class="btn btn-default">马上报名</button>'+
						'		</div>'+
						'	</div>'+
						'</li>';
			return html;
		}
		//报名列表返回
		function callbackGetTicketsList(data) {
			if (data.success) {
				var html = "";
				for (var i=0; i<data.context.ticketsList.length; i++) {
					html += pingTicketsList(data.context.ticketsList[i]);
				}
				$("#tab-panel3 .list-ul").html(html);
			}
		}
		function pingTicketsList(data) {
			var html = '<li class="list-li">'+
						'	<label class="radio-inline">';
						if (ticketsRadioID == data.ticketsID) {
				html +=	'		<input type="radio" checked="checked" name="ticketsRadio" value="'+data.ticketsID+'">';
						}else{
				html +=	'		<input type="radio" name="ticketsRadio" value="'+data.ticketsID+'">';			
						}
				html +=	'	</label>'+
						'	<div class="list-body">'+
						'		<div class="ad-name">'+
						'			<a>'+data.theme+'</a>'+
						'		</div>'+
						'		<div class="href-btn">'+
						'			<button type="button" class="btn btn-default">马上领取</button>'+
						'		</div>'+
						'	</div>'+
						'</li>';
			return html;
		}
		//商品列表返回
		function callbackGetGoodsList(data){
			if (data.success) {
				$("#tab-panel4 .list-ul").html(pinGoodsList(data.context.goodsList));
			}
		}
		function pinGoodsList(list) {
			var html = '';
			for (var index in list) {
				html += '<li class="list-li">'+
						'	<label class="radio-inline">';
						if (goodsRadioID == list[index].goodsId) {
				html +=	'		<input type="radio" checked="checked" name="goodsRadio" value="'+list[index].goodsId+'">';
						}else{
				html +=	'		<input type="radio" name="goodsRadio" value="'+list[index].goodsId+'">';			
						}
				html +=	'	</label>'+
						'	<div class="list-body">'+
						'		<div class="ad-name">'+
						'			<a>'+list[index].title+'</a>'+
						'		</div>'+
						'		<div class="href-btn">'+
						'			<button type="button" class="btn btn-default">立即购买</button>'+
						'		</div>'+
						'	</div>'+
						'</li>';
			}
			return html;
		}
		//代金券返回列表
		function callbackGetVouchersList(data) {
			if (data.success) {
				$("#tab-panel5 .list-ul").html(pinVouchersList(data.context.vouchersList));
			}
		}
		function pinVouchersList(list) {
			var html = '';
			for (var index in list) {
				html += '<li class="list-li">'+
						'	<label class="radio-inline">';
						if (vouchersRadioID == list[index].vouchersID) {
				html +=	'		<input type="radio" checked="checked" name="vouchersRadio" value="'+list[index].vouchersID+'">';
						}else{
				html +=	'		<input type="radio" name="vouchersRadio" value="'+list[index].vouchersID+'">';			
						}
				html +=	'	</label>'+
						'	<div class="list-body">'+
						'		<div class="ad-name">'+
						'			<a>满'+list[index].fullRedPrice+'减'+list[index].vouchersPrice+'代金券</a>'+
						'		</div>'+
						'		<div class="href-btn">'+
						'			<button type="button" class="btn btn-default">立即领取</button>'+
						'		</div>'+
						'	</div>'+
						'</li>';
			}
			return html;
		}
		//打折券列表返回
		function callbackGetDiscountCouponsList(data) {
			if (data.success) {
				$("#tab-panel6 .list-ul").html(pinDiscountCouponsList(data.context.discountCouponsList));
			}
		}
		function pinDiscountCouponsList(list) {
			var html = '';
			for (var index in list) {
				html += '<li class="list-li">'+
						'	<label class="radio-inline">';
						if (discountCouponsRadioID == list[index].discountCouponsID) {
				html +=	'		<input type="radio" checked="checked" name="discountCouponsRadio" value="'+list[index].discountCouponsID+'">';
						}else{
				html +=	'		<input type="radio" name="discountCouponsRadio" value="'+list[index].discountCouponsID+'">';			
						}
				html +=	'	</label>'+
						'	<div class="list-body">'+
						'		<div class="ad-name">'+
						'			<a>'+list[index].discount+'折打折券</a>'+
						'		</div>'+
						'		<div class="href-btn">'+
						'			<button type="button" class="btn btn-default">立即领取</button>'+
						'		</div>'+
						'	</div>'+
						'</li>';
			}
			return html;
		}
		//单选框反选
		$(".tab-content").on("mousedown", "input[type='radio']", function(e){
			var radioChecked = $(this).prop("checked");
	        $(this).prop('checked', !radioChecked);
	        return false;
		});
		$(".tab-content").on("click", "input[type='radio']", function(e){
			return false;
		});
		//公司标签列表返回
		function callbackLableList(data) {
			if (data.success) {
				var html = "";
				for (var i=0; i<data.context.dataList.length; i++) {
					var isActive = false;
					if (lableIDList != null && lableIDList != "") {
						for (var j=0; j<lableIDList.length; j++) {
							if (data.context.dataList[i].id == lableIDList[j]) {
								isActive = true;
								break;
							}
						}
					}
					if (isActive) {
						html += '<span class="label label-default active" data-id="'+data.context.dataList[i].id+'">'+data.context.dataList[i].lableName+'</span>'
					}else{
						html += '<span class="label label-default" data-id="'+data.context.dataList[i].id+'">'+data.context.dataList[i].lableName+'</span>'	
					}
					
				}
				$(".label-select .label-group").html(html);
			}
		}
		//点击选择标签
		$(".label-select .label-group").on("click", "span", function(){
			//正反选
			if ($(this).attr("class").indexOf("active") != -1) {
				$(this).removeClass("active");
			}else{
				var lableLength = $(this).closest(".label-group").find(".active").length;
				if (lableLength >= 6) {
					toastr.warning("最多选择六个标签！");
					return;
				}
				$(this).addClass("active");
			}
		});
		//推文详情返回
		function callbackGetArticleInfo(data) {
			if (data.success) {
				$("#contentsLink").val(data.context.contentsLink);
				$("#title").val(data.context.articleTitle);
				$("#abstracts").val(data.context.articleAbstracts);
				$("#imageUrl").val(data.context.articleImage);
				$(".preview-img").css("background-image", "url("+data.context.articleImage+")");
				$(".preview-img").css("background-size", "100% 100%");
				$(".preview-img").css("background-color","#fff");
				$(".preview-img p").hide();
				for (var i=0;i<data.context.pluginList.length;i++) {
					if (data.context.pluginList[i].pluginType == 0) {//名片
						cardsRadioID = data.context.pluginList[i].pluginID;
					} else if (data.context.pluginList[i].pluginType == 1) {//报名
						enrollRadioID = data.context.pluginList[i].pluginID;
					} else if (data.context.pluginList[i].pluginType == 2) {//商品
						goodsRadioID = data.context.pluginList[i].pluginID;
					} else if (data.context.pluginList[i].pluginType == 3) {//代金券
						vouchersRadioID = data.context.pluginList[i].pluginID;
					} else if (data.context.pluginList[i].pluginType == 4) {//门票
						ticketsRadioID = data.context.pluginList[i].pluginID;
					} else if (data.context.pluginList[i].pluginType == 5) {//打折券
						discountCouponsRadioID = data.context.pluginList[i].pluginID;
					}
				}
				lableIDList = new Array();
				for (var i=0;i<data.context.lableList.length;i++) {
					lableIDList.push(data.context.lableList[i].id);
				}
				//获取卡片列表
				base.postData(base.url.getCardList, {userID:userID,companyID:companyID,type:1}, callbackGetCardList);
				//获取报名列表
				base.postData(base.url.getEnrollList, {userID:userID,companyID:companyID,type:1}, callbackGetEnrollList);
				//获取门票列表
				base.postData(base.url.getTicketsList, {userID:userID,companyID:companyID,type:1}, callbackGetTicketsList);
				//获取商品列表
				base.postData(base.url.getGoodsList, {userID:userID,companyID:companyID,type:1}, callbackGetGoodsList);
				//获取代金券
				base.postData(base.url.getVouchersList, {userID:userID,companyID:companyID}, callbackGetVouchersList);
				//获取打折券
				base.postData(base.url.getDiscountCouponsList, {userID:userID,companyID:companyID}, callbackGetDiscountCouponsList);
				//获取公司标签
				base.postData(base.url.lableList, {userID:userID,companyID:companyID}, callbackLableList);
			}
		}
		//点击按钮保存文章
		$(".operate-btn button").click(function(){
			operation = $(this).attr("data-param");
			saveArticle();
		});
		//保存文章
		function saveArticle(){
			var isCheckOk = true;
			var contentsLink = $("#contentsLink").val();
			if (!isURL(contentsLink)) {
				$("#contentsLinkPrompt").css("visibility","visible");
				isCheckOk = false;
			}
			var title = $("#title").val();
			if (title == null || title == "") {
				$("#title").closest(".title-prompt").find(".input-prompt").css("visibility","visible");
				isCheckOk = false;
			}
			var abstracts = $("#abstracts").val();
			if (abstracts == null || abstracts == "") {
				$("#abstracts").closest(".title-prompt").find(".input-prompt").css("visibility","visible");
				isCheckOk = false;
			}
			var imageUrl = $("#imageUrl").val();
			if (imageUrl == null || imageUrl == "") {
				$(".preview-img p").text("预览图不能为空").css("color","red");
				isCheckOk = false;
			}
			if (!isCheckOk) {
				return;
			}
			//获取插件
			var pluginJson = new Array();
			var pluginNum = 0;
			var cardsRadio = $("input[name='cardsRadio']:checked").val();
			if (cardsRadio != null && cardsRadio != "") {
				pluginNum ++;
				pluginJson.push({"pluginType":0,"pluginID":cardsRadio})
			}
			var enrollRadio = $("input[name='enrollRadio']:checked").val();
			if (enrollRadio != null && enrollRadio != "") {
				pluginNum ++;
				pluginJson.push({"pluginType":1,"pluginID":enrollRadio})
			}
			var goodsRadio = $("input[name='goodsRadio']:checked").val();
			if (goodsRadio != null && goodsRadio != "") {
				pluginNum ++;
				pluginJson.push({"pluginType":2,"pluginID":goodsRadio})
			}
			var ticketsRadio = $("input[name='ticketsRadio']:checked").val();
			if (ticketsRadio != null && ticketsRadio != "") {
				pluginNum ++;
				pluginJson.push({"pluginType":4,"pluginID":ticketsRadio})
			}
			var vouchersRadio = $("input[name='vouchersRadio']:checked").val();
			if (vouchersRadio != null && vouchersRadio != "") {
				pluginNum ++;
				pluginJson.push({"pluginType":3,"pluginID":vouchersRadio})
			}
			var discountCouponsRadio = $("input[name='discountCouponsRadio']:checked").val();
			if (discountCouponsRadio != null && discountCouponsRadio != "") {
				pluginNum ++;
				pluginJson.push({"pluginType":5,"pluginID":discountCouponsRadio})
			}
			if (pluginNum > 3) {
				toastr.warning("不能选择超过三种插件！");
				return;
			}
			pluginJson = JSON.stringify(pluginJson)
			//获取标签
			var lableLength = $(".label-select .label-group").find(".active").length;
			if (lableLength >= 6) {
				toastr.warning("最多选择六个标签！");
				return;
			}
			var lableID = "";
			$(".label-select .label-group").find(".active").each(function(i){
				if ((i+1) == lableLength) {
					lableID += $(this).attr("data-id");
				}else{
					lableID += $(this).attr("data-id") + ",";
				}
			})
			var data = {
				userID:userID,
				companyID:companyID,
				articleID:articleID,
				title:title,
				abstracts:abstracts,
				imageUrl:imageUrl,
				pluginJson:pluginJson,
				lableID:lableID,
				category:1,
				contentsLink:contentsLink
			}
			base.postData(base.url.updateArticleInfo, data, callbackUpdateArticleInfo);
		}
		function callbackUpdateArticleInfo(data) {
			if (data.success) {
				articleID = data.context.articleID;
				QRCodeUrl = data.context.QRCodeUrl;
				if (operation == 1) {//分任务
					showSubTaskModel();
				}else if (operation == 2) {//保存文章
					toastr.info("保存成功！");
				}else if (operation == 3) {//预览
					showPreviewModel();
				}else if (operation == 4) {//发布
					showPublishModel();
				}
			}else{
				toastr.warning(data.msg);
			}
		}
		function showPreviewModel(){
			base.postData(base.url.getArticleInfo, {userID:userID,companyID:companyID,articleID:articleID}, callbackShowPreviewModel);
		}
		function callbackShowPreviewModel(data){
			if (data.success) {
				$("#iframePage").attr("src", data.context.contentsLink);
				$('.preview-qrcode .qrcode').html("");
				$('.preview-qrcode .qrcode').qrcode(data.context.QRCodeUrl);
				var wechat = '<div class="wechat-title text-ellipsis">'+data.context.articleTitle+'</div>'+
		    				'<div class="wechat-content">'+
			    			'	<div class="wechat-describe">'+data.context.articleAbstracts+'</div>'+
			    			'	<div class="wechat-icon">'+
			    			'		<img src="'+data.context.articleImage+'"/>'+
			    			'	</div>'+
			    			'</div>';
				$(".wechat-share").html(wechat);
				//插件管理
				var plugLength = data.context.pluginList.length;
				if (plugLength == 0) {//没有插件
					$("#iframePage").css("height","347px");
				}else if (plugLength == 1) {//一种插件
					$("#iframePage").css("height","280px");
					//判断那种插件
					if (data.context.pluginList[0].pluginType == 0){//名片
						var card = data.context.pluginList[0].card;
						var html = '<a class="head-img customer-phone-click" href="tel:'+card.cardUserPhone+'">'+
									'	<img src="'+card.cardHeadImgUrl+'" />'+	
									'</a>'+
									'<div class="user-info-bar">'+
									'	<input type="hidden" name="cardID" value="'+card.id+'" />'+
									'	<span class="name">'+card.cardUserName+'</span><span class="position">'+card.post+'</span><br />'+
									'	<a class="phone customer-phone-click" href="tel:'+card.cardUserPhone+'">'+card.cardUserPhone+'</a>'+
									'</div>';
						$(".card-tab .user-item").html(html);
						$(".card-tab .phone-item").attr("href","tel:"+card.cardUserPhone);
						$(".user-qrcode-img").html('<img src="'+card.wxQcImgUrl+'" />');
						$(".card-tab").css("display","table");
					} else if (data.context.pluginList[0].pluginType == 1) {//报名
						$(".content").css("margin-bottom","50px");
						pluginID = data.context.pluginList[0].pluginID;
						$(".enroll-tab .title-item").text(data.context.pluginList[0].enroll.activityTitle);
						$(".enroll-tab .btn-item button").text(data.context.pluginList[0].enroll.enrollButton);
						$(".enroll-tab").css("display","table");
					} else if (data.context.pluginList[0].pluginType == 4) {//领票
						$(".content").css("margin-bottom","50px");
						pluginID = data.context.pluginList[0].pluginID;
						$(".tickets-tab .title-item").text(data.context.pluginList[0].activity.theme);
						$(".tickets-tab").css("display","table");
					}
				}else if (plugLength > 1) {//两种插件
					for (var i=0; i<data.context.pluginList.length; i++) {
						if (data.context.pluginList[i].pluginType==0) {
							$(".merge-tab .merge-user-item").css("display", "table-cell");
							$(".merge-tab .merge-qrcode-item").css("display", "table-cell");
							var card = data.context.pluginList[i].card;
							var html = '<a class="head-img customer-phone-click" href="tel:'+card.cardUserPhone+'">'+
										'	<img src="'+card.cardHeadImgUrl+'" />'+	
										'</a>'+
										'<div class="user-info-bar">'+
										'	<input type="hidden" name="cardID" value="'+card.id+'" />'+
										'	<span class="name">'+card.cardUserName+'</span><span class="position">'+card.post+'</span><br />'+
										'	<a class="phone customer-phone-click" href="tel:'+card.cardUserPhone+'">'+card.cardUserPhone+'</a>'+
										'</div>';
							$(".merge-tab .merge-user-item").html(html);
							$(".user-qrcode-img").html('<img src="'+card.wxQcImgUrl+'" />');
						}else if (data.context.pluginList[i].pluginType==1) {
							pluginID = data.context.pluginList[i].pluginID;
							$(".merge-tab .merge-enroll-item").css("display", "table-cell");
							$(".merge-tab .merge-enroll-item").html('<span class="font-theme">报名</span>');
						} else if (data.context.pluginList[i].pluginType==4) {
							pluginID = data.context.pluginList[i].pluginID;
							$(".merge-tab .merge-ticket-item").css("display", "table-cell");
							$(".merge-tab .merge-ticket-item").html('<span class="font-theme">领票</span>');
						}
					}
					$(".merge-tab").css("display","table");
				}
				$("#previewModel").modal('show');
			}else{
				toastr.warning(data.msg);
			}
		}
		function showPublishModel(){
			$('.publish-qrcode .qrcode').html("");
			$('.publish-qrcode .qrcode').qrcode(QRCodeUrl);
			$("#publishModel").modal('show');
		}
		function showSubTaskModel(){
			base.postData(base.url.getDepartListAndEmployeeList, {userID:userID,companyID:companyID}, callbackStaffList);
		}
		function callbackStaffList(data){
			if (data.success) {
				var departList = data.context.departList;
				var html = '<li class="tree-li">'+
							'	<span class="tree-arrow active"></span>'+
							'	<span class="tree-title">'+data.context.companyName+'</span>'+
							'	<input type="checkbox" />'+
							'	<ul class="tree-ul">';
				for (var i=0; i<departList.length; i++) {
					html += '		<li class="tree-li">'+
							'			<span class="tree-arrow active"></span>'+
							'			<span>'+departList[i].departName+'</span>'+
							'			<input type="checkbox" name="departBox" value="'+departList[i].departID+'" />'+
							'			<ul class="tree-ul">';
					for (var j=0; j<departList[i].employeeList.length; j++) {
					html += '				<li class="tree-li">'+
							'					<img class="border-radius-20" src="'+departList[i].employeeList[j].headImageUrl+'" />'+
							'					<span class="staff-name">'+departList[i].employeeList[j].userName+'</span>'+
							'					<input type="checkbox" name="employeeBox" value="'+departList[i].employeeList[j].employeeID+'"/>'+
							'				</li>';
					}
					html += '		</ul></li>';
				}
					html += '</ul></li>';
				$("#staffTree").html(html);
				$("#subTaskModel").modal('show');
			}else {
				toastr.warning(data.msg);
			}
		}
		//点击员工树的收缩和展开
		$(".tree-view").on('click', '.tree-li', function(e){
			e.stopPropagation(); //阻止冒泡
			if ($(this).find(".tree-ul").length > 0) {
				if ($(this).find(".tree-ul").first().attr("class").indexOf("hide") != -1) {
					$(this).find(".tree-ul").first().attr("class", "tree-ul show");
					$(this).find(".tree-arrow").first().addClass("active");
					
				}else {
					$(this).find(".tree-ul").first().attr("class", "tree-ul hide");
					$(this).find(".tree-arrow").first().removeClass("active");
				}	
			}
		});
		//点击员工树点复选框
		$(".tree-view").on("click", ".tree-li input[type='checkbox']", function(e){
			e.stopPropagation(); //阻止冒泡
			if ($(this).prop("checked")) {
				if ($(this).closest(".tree-li").find(".tree-ul").length > 0 && $(this).closest(".tree-li").find(".tree-ul").first().attr("class").indexOf("hide")) {
					$(this).closest(".tree-li").find(".tree-ul").first().attr("class", "tree-ul show");
					$(this).closest(".tree-li").find(".tree-arrow").first().addClass("active");
				}
				$(this).closest(".tree-li").find("input[type='checkbox']").each(function(){
					$(this).prop("checked",true);
				});
				var checkAll = $(this).closest(".tree-ul").closest(".tree-li").find("input[type='checkbox']").length - 1;
				var checkeds = $(this).closest(".tree-ul").closest(".tree-li").find("input[type='checkbox']:checked").length;
				if (checkAll == checkeds) {
					$(this).closest(".tree-ul").closest(".tree-li").find("input[type='checkbox']").first().prop("checked",true);
				}
				//选中添加到已选员工列表
				var selectedList = ""
				$(this).closest(".tree-li").find("input[name='employeeBox']").each(function(){
					var employeeID = $(this).val();
					var isExist = false;
					$("#selectList .tree-ul").find("input[name='employeeID']").each(function(){
						if ($(this).val() == employeeID) {
							isExist = true;
							return false;
						}
					});
					if (isExist) {
						return true;
					}
					selectedList += '<li class="tree-li">'+
									'	<input type="hidden" name="employeeID" value="'+employeeID+'" />'+
									'	<img class="border-radius-20" src="'+$(this).closest(".tree-li").find("img").attr("src")+'" />'+
									'	<span class="staff-name">'+$(this).closest(".tree-li").find(".staff-name").text()+'</span>'+
									'	<button class="close"><span>&times;</span></button>'+
									'</li>';
				});
				$("#selectList .tree-ul").append(selectedList);
			}else{
				$(this).closest(".tree-li").find("input[type='checkbox']").each(function(){
					$(this).prop("checked",false);
				});
				$(this).closest(".tree-ul").closest(".tree-li").find("input[type='checkbox']").first().prop("checked",false);
				//取消选中删除已选员工列表
				$(this).closest(".tree-li").find("input[name='employeeBox']").each(function(){
					var employeeID = $(this).val();
					$("#selectList .tree-ul").find("input[name='employeeID']").each(function(){
						if ($(this).val() == employeeID) {
							$(this).closest(".tree-li").remove();
						}
					});
				});
			}
			
		});
		//搜索员工
		$('#searchInput').bind('keyup', function(event) {
			if (event.keyCode == "13") {
		　　　　//回车执行查询
				$(this).blur();
				base.postData(base.url.getDepartListAndEmployeeList, {userID:userID,companyID:companyID,userName:$(this).val()}, callbackStaffList);
		　　	}
		});
		//删除已选员工
		$("#selectList").on("click", ".close", function(){
			$(this).closest("li").remove();
		});
		//是否限制分任务时间
	    $('#noLimitData').on('click',function(){
	    	if ($(this).find("input[type='checkbox']").prop("checked")) {
	    		$("#startDateTime").attr('disabled','disabled').val("");
	    		$("#endDateTime").attr('disabled','disabled').val("");
	    		$('.form_datetime').datetimepicker('remove');	
	    	}else{
	    		$('#startDateTime').removeAttr('disabled');
	    		$('#endDateTime').removeAttr('disabled');
	    		$('#startDateTimePicker').datetimepicker({
	    			format:'yyyy-mm-dd',
	    			language:'zh-CN',
	    			startDate:base.getNowFormatToday(),
			        weekStart: 1,
			        todayBtn:  true,
					autoclose: true,
					startView: 2,
					minView: 2,
					forceParse: 0,
			        showMeridian: true
	    		});
	    		$('#endDateTimePicker').datetimepicker({
	    			format:'yyyy-mm-dd',
	    			language:'zh-CN',
	    			startDate:addDate(base.getNowFormatToday(),1),
			        weekStart: 1,
			        todayBtn:  true,
					autoclose: true,
					startView: 2,
					minView: 2,
					forceParse: 0,
	    		});
	    	}
	    });
	    //确认分配任务
		$("#saveSubTask").click(function(){
			var isLimitDate = $("#noLimitData").find("input[type='checkbox']").prop("checked");
			var startDate = $("#startDateTime").val();
			var endDate = $("#endDateTime").val();
			if (!isLimitDate) {
				if (startDate == "" || endDate == "") {
					toastr.warning("限制时间格式不对！");
					return;
				}
			}
			var userIds = "";
			$("#selectList .tree-ul").find("input[name='employeeID']").each(function(i){
				if ((i+1) == $("#selectList .tree-ul").find("input[name='employeeID']").length) {
					userIds += $(this).val();
				}else{
					userIds += $(this).val() + ",";
				}
			});
			if (userIds == "") {
				toastr.warning("请选择要分配任务的员工！");
				return;
			}
			if (isLimitDate) {
				isLimitDate = 0;
			}else{
				isLimitDate = 1;
			}
			var data = {
				userID:userID,
				companyID:companyID,
				articleID:articleID,
				userIds:userIds,
				forwordNum:$("#forwordNum").val(),
				readNum:$("#readNum").val(),
				enrollNum:$("#enrollNum").val(),
				startDate:startDate,
				endDate:endDate,
				isLimitDate:isLimitDate
			}
			base.postData(base.url.addDistributionTask, data, callbackSaveSubTask);
		});
		function callbackSaveSubTask(data){
			if (data.success) {
				$('#subTaskModel').modal('hide')
				toastr.success("分配员工任务成功！");
			}else{
				toastr.warning(data.msg);
			}
		}
		//上传INPUT
		function handleInputChange(obj){
			//先判断是否已有五张图片
			var fileData = event.target.files[0];
			var imgMasSize = 1024 * 1024 * 5; // 5MB
			if ($(obj).attr("name") == "eidtorVideo") {
				imgMasSize = 1024 * 1024 * 50; // 50MB
				// 检查文件类型
			    if(['mp4', 'webm', 'ogg'].indexOf(fileData.type.split("/")[1]) < 0){
			        toastr.warning("文件类型仅支持 mp4/webm/ogg！");
			        return;
			    }
			    // 文件大小限制
			    if(fileData.size > imgMasSize ) {
			        // 文件大小自定义限制
			        toastr.warning("文件大小不能超过50MB！");
			        return;
			    }
			}else {
				// 检查文件类型
			    if(['jpeg', 'png', 'gif', 'jpg', 'bmp'].indexOf(fileData.type.split("/")[1]) < 0){
			        toastr.warning("文件类型仅支持 jpeg/png/gif/jpg!");
			        return;
			    }
			    // 文件大小限制
			    if(fileData.size > imgMasSize ) {
			        // 文件大小自定义限制
			        toastr.warning("文件大小不能超过5MB！");
			        return;
			    }
			}
			uploadFile(obj,fileData);
		}
		//上传图片
		function uploadFile(obj,files){
			toastr.info("正在上传，请稍等...");
			var formData = new FormData();
			formData.append('Filedata', files);
			if ($(obj).attr("name") == "eidtorVideo") {
				formData.append('type', 2);
			}else{
				formData.append('type', 1);
			}
			$.ajax({
	            url: base.url.uploadFile,
	            method: 'POST',
	            data: formData,
	            contentType: false, // 注意这里应设为false
	            processData: false,
	            cache: false,
	            success: function(data) {
	            	console.log(data.obj);
	            	pingFileData(obj, data.obj);
	            },
	            error: function (jqXHR) {
	                toastr.warning(JSON.stringify(jqXHR));
	            }
	        })
		}
		
		function pingFileData(obj, fileUrl){
			if ($(obj).attr("name") == "previewImg") {
				$("#imageUrl").val(fileUrl);
				$(".preview-img").css("background-image", "url("+fileUrl+")");
				$(".preview-img").css("background-size", "100% 100%");
				$(".preview-img").css("background-color","#fff");
				$(".preview-img p").hide();
			}else if ($(obj).attr("name") == "eidtorImg") {
				UE.getEditor('myEditor').setContent('<img style="max-width:100%;max-height:100%;" src="'+fileUrl+'" />', true);
				UE.getEditor('myEditor').focus();
			}else if ($(obj).attr("name") == "eidtorVideo") {
				UE.getEditor('myEditor').execCommand('inserthtml','<video src="'+fileUrl+'" style="width:100%;height:auto" controls="controls" controlsList="nodownload"></video>');
            	UE.getEditor('myEditor').focus();
			}
		}
		
		function addDate(date,days){ 
	       	var d=new Date(date); 
	       	d.setDate(d.getDate()+days); 
	       	var month=d.getMonth()+1; 
	       	var strDate = d.getDate();
	       	if (month >= 1 && month <= 9) {
		        month = "0" + month;
		   	}
		    if (strDate >= 0 && strDate <= 9) {
		        strDate = "0" + strDate;
		   	}
	       	return d.getFullYear()+'-'+month+'-'+strDate; 
	    }
	</script>
</body>
</html>
